package hmvc4gwt.client.controller;

import hmvc4gwt.client.component.IComponent;
import hmvc4gwt.client.component.IInitializeAble;
import hmvc4gwt.client.component.ITerminateAble;
import hmvc4gwt.client.event.IHmvcEvent;
import hmvc4gwt.client.event.IHmvcEventListener;
import hmvc4gwt.client.model.IModel;
import hmvc4gwt.client.view.IView;

public interface IController extends IInitializeAble, ITerminateAble, IHmvcEventListener {
	
	public IComponent addChildComponent(IController controller);
	
	public IComponent addChildComponent(IController controller, IModel model);
	
	public IComponent addChildComponent(IController controller, IModel model,
			IView view);
	
	public IComponent addChildComponent(IController controller, IView view);
	
	/**
	 * fires the Event in the given direction
	 * @param event
	 * @param up
	 * @param local
	 * @param down
	 */
	public void fireEvent(IHmvcEvent event, boolean up, boolean local,
			boolean down);
	
	/**
	 * fires the Event down
	 */
	public void fireEventDown(IHmvcEvent event);
	
	/**
	 * fires the Event up
	 */
	public void fireEventUp(IHmvcEvent event);
	
	/**
	 * fires the Event to the local listeners
	 * @param event
	 */
	public void fireEventLocal(IHmvcEvent event);
	
	/**
	 * work-a-round for the not implemented Object.getClass()-Method
	 */
	public Class getClassOfObject();
	
	/**
	 * returns the Component of the Controller
	 * @param component
	 */
	public IComponent getComponent();
	
	/**
	 * delegate from component.getModel();
	 * @return
	 */
	public IModel getModel();
	
	/**
	 * delegate from component.getView();
	 * @return
	 */
	public IView getView();
	
	/**
	 * delegate to this.component.register(Class classOfEvent, HmvcEventListener listener)
	 * @param classOfEvent
	 * @param listener
	 */
	public void register(Class classOfEvent, IHmvcEventListener listener);
	
	/**
	 * sets the Component to wich the controller contains
	 * 
	 * @param component
	 */
	public void setComponent(IComponent component);
}
